package com.itheima.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.pojo.Produck;


import java.util.List;

@Controller
public class ProduckController {
    //   @RequestMapping("/getProduck")
    //  public void getProduck(String[] proId){
    //     for (String proIdid : proId){
    //       System.out.println("获取到了id为"+proIdid+"的商品");
    //    }
    //  }
    @RequestMapping("/getProduck")
    public void getProduck(@RequestParam("proId") List<String> proId) {
        for (String proIdid : proId) {
            System.out.println("获取到了id为" + proId + "的商品");
        }
    }

    @RequestMapping("/getProduck")
    public void getProduck(@RequestBody Produck Produck) {
        String proId = Produck.getProId();
        String proName = Produck.getProName();
        System.out.println("获取到了id为" + proId + "的商品，名称为" + proName + "的商品");
    }

    @RequestMapping("/getProduckList")
    public void getProduckList(@RequestBody List<Produck> ProduckList) {
        for (Produck Produck : ProduckList) {
            String proId = Produck.getProId();
            String proName = Produck.getProName();
            System.out.println("获取到了id为" + proId + "，名称为" + proName + "的商品");
        }
    }
}
